package com.ef.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

import com.ef.constant.StatusType;

@Entity
public class Team implements Serializable {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;

	@Column(length = 200)
	private String name;

	@Column(length = 2000)
	private String description;

	@ManyToOne(fetch = FetchType.EAGER)
	private Department department;

	@Enumerated(value = EnumType.STRING)
	private StatusType status = StatusType.VALID;

	public StatusType getStatus() {
		return status;
	}
    //cyg100320硬编码 
	public String getAdultOrChild() {
		if (name != null && name.toUpperCase().indexOf("CHILD") > -1) {
			return "[Child]";
		} else if (name != null && name.toUpperCase().indexOf("ADULT") > -1) {
			return "[Adult]";
		} else {
			return "";
		}
	}

	public void setStatus(StatusType status) {
		this.status = status;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Department getDepartment() {
		return department;
	}

	public void setDepartment(Department department) {
		this.department = department;
	}

}
